import 'package:flutter/material.dart';
import 'package:get/get.dart';

class TestContextPage extends StatelessWidget {
  const TestContextPage({super.key});

  @override
  Widget build(BuildContext context) {
    print('JtTag:TestContextPage:${context.hashCode}');
    return Scaffold(
        appBar: AppBar(title: const Text('TestContextPage')),
        body: Column(children: [
          ElevatedButton(onPressed: () {
            showDialog(context);
          }, child: const Text('点击弹窗'))
        ])
    );
  }

  showDialog(BuildContext c) {
    print('JtTag:TestContextPage:${c.hashCode}');
    c.dependOnInheritedElement();
    showModalBottomSheet(context: c, builder: (context) {
      print('JtTag:TestContextPage:${context.hashCode}');
      print('JtTag:TestContextPage:Get.context:${Get.context!.hashCode}');
      return Container(
        child: Column(
          children: [
            ElevatedButton(onPressed: () {
              // Navigator.of(context).pop();
              // Navigator.of(context).pop();
              Navigator.of(context).pop('1');
            }, child: const Text('点击关闭弹窗'))
          ],
        ),
      );
    }).then((value) {
      print('JtTag:testName:${value}');
    });
  }
}


